using System;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Modularity;

namespace Leo.Core.Jwt
{
    public static class JwtServiceCollectionExtention
    {
        public static void ConfigureJwtTokenService(this ServiceConfigurationContext context, Action<BinderOptions> configureBinder = null)
        {
            var configuration = context.Services.GetConfiguration();

            //使用JWT验证
            context.Services.Configure<JwtOption>(configuration.GetSection(JwtOption.SectionName), configureBinder);

            context.Services.AddSingleton<ITokenService, JwtTokenService>();
        }
    }
}
